﻿@model IEnumerable<Archive>
@{    
    Ajax.Dna().Widget()
        .Preview(@<text>
    <ul class="ui-helper-reset">
        <li><a class="d-link" href="javascript:void(0);" style="display: inline-block; padding: 5px;"
            title="">
            <img class="d-icon" src="@Url.Content("~/Content/Images/calender.gif") "  alt="" />
            2011-1 </a></li>
        <li><a class="d-link" href="javascript:void(0);" style="display: inline-block; padding: 5px;"
            title="">
            <img class="d-icon" src="@Url.Content("~/Content/Images/calender.gif") "  alt="" />
            2011-2</a></li>
        <li><a class="d-link" href="javascript:void(0);" style="display: inline-block; padding: 5px;"
            title="">
            <img class="d-icon" src="@Url.Content("~/Content/Images/calender.gif") "  alt="" />
            2011-3 </a></li>
        <li><a class="d-link" href="javascript:void(0);" style="display: inline-block; padding: 5px;"
            title="">
            <img class="d-icon" src="@Url.Content("~/Content/Images/calender.gif") "  alt="" />
            2011-4</a></li>
        <li><a class="d-link" href="javascript:void(0);" style="display: inline-block; padding: 5px;"
            title="">
            <img class="d-icon" src="@Url.Content("~/Content/Images/calender.gif") "  alt="" />
            2011-5 </a></li>
    </ul>
    </text>)
        .Content(@<text>
    @if (Model.Count() > 0)
    { 
        @(Ajax.DnaFor().ListBox(Model)
        .HtmlAttributes(new { style = "width:auto;border:none;background-color:transparent;" })
            .ItemTemplate(archive => { return this._ArchiveItemTemplate(archive); })
            .Name(item.GenerateFieldID("ArchivesList"))
                .GetHtml()
                )
    }
    else
    { 
        <div style="padding: 10px;">@Html.Global("Publishing", "NoArchives")
        </div>
    }
    </text>)
        .Render();
}
@helper _ArchiveItemTemplate(Archive archive)
    {
    <a target="_blank" class="d-link" href="@Url.Action("Archive", "Article", new { Area = "Publishing", website = WebSiteContext.Current.Web.Name, year = archive.Year, month = (archive.Month < 10 ? ("0" + archive.Month.ToString()) : archive.Month.ToString()) })" style="display: inline-block; padding: 5px;" title="@archive.DisplayText">
        <img class="d-icon" src="@Url.Content("~/Content/Images/calender.gif") "  alt="" />
        @(archive.MonthName + " " + archive.Year.ToString())
    </a>
}
